package com.jrx.anytxn.reporting.service;

import com.jrx.anytxn.common.exception.TxnBizException;
import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.customer.entity.CmCustomerAddressInfo;
import com.jrx.anytxn.customer.entity.CmCustomerFirstLevel;
import com.jrx.anytxn.customer.entity.CmCustomerLimitInfo;
import com.jrx.anytxn.customer.entity.CmCustomerSecondLevel;
import com.jrx.anytxn.param.entity.PrOrganizationTable;
import com.jrx.anytxn.transaction.entity.*;

import java.io.IOException;
import java.util.List;

public interface IUnionFileService {

    /**
     * 根据文件名生成对应目录和空文件
     * @param basePath
     * @param fileName
     * @param fileType
     */
    void createDirectoriesAndFile(String basePath,String fileName,String fileType);

    /**
     * 生成放款流水文件信息
     * @param tlDisbursementLog
     * @return
     * @throws TxnException
     */
    String createLoanSerialFileMessage(TlDisbursementLog tlDisbursementLog) throws TxnException;

    /**
     * 生成联盟客户信息文件(全量)
     * @param cmCustomerFirstLevel
     * @return
     */
    String createUnionCustInfoFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成联盟授信文件(增量)
     * @param cmCustomerLimitInfo
     * @return
     */
    String createCreditInfoFileMessage(CmCustomerLimitInfo cmCustomerLimitInfo) throws TxnException;

    /**
     * 生成联盟联系点文件(增量)
     * @param cmCustomerFirstLevel
     * @return
     */
    String createUserContactFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成联盟借据产品信息表(增量)
     * @param amLoanMainInfo
     * @return
     */
    String createLoanProductFileMessage(AmLoanMainInfo amLoanMainInfo) throws TxnException;

    /**
     * 生成联盟还款流水文件(增量)
     * @param tlPaymentLog
     * @return
     */
     List<String> createRepayFileMessage(TlPaymentLog tlPaymentLog) throws TxnException;

    /**
     * 生成联盟还款流水文件(增量)
     * @param tlThirdPartyPayment
     * @return
     */
    String createThirdRepayFileMessage(TlThirdPartyPayment tlThirdPartyPayment) throws TxnException;

    /**
     * 生成联盟订单信息文件(全量)
     * @param amLoanAccountInfo
     * @return
     */
    String createLoanInfoFileMessage(AmLoanAccountInfo amLoanAccountInfo) throws TxnException;

    /**
     * 生成联盟证件文档(增量)
     * @param cmCustomerFirstLevel
     * @return
     * @throws TxnException
     */
    String createCertificateInfoFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成计提文件(增量)
     * @param tlInterestAccrualLog
     * @return
     */
    String createAccruedSerialFileMessage(TlInterestAccrualLog tlInterestAccrualLog) throws TxnException;

    /**
     * 生成合同文件(全量)
     * @param amLoanAccountInfo
     * @return
     */
    String createContractFileMessage(AmLoanAccountInfo amLoanAccountInfo) throws TxnException;

    /**
     * 生成还款计划文件(增量)
     * @param amRepaymentPlanInfo
     * @return
     * @throws TxnBizException
     */
    String createRepayPlanFileMessage(AmRepaymentPlanInfo amRepaymentPlanInfo) throws TxnException;

    /**
     * 生成地址联系点文件(增量)
     * @param cmCustomerAddressInfo
     * @return
     */
    String createAddressFileMessage(CmCustomerAddressInfo cmCustomerAddressInfo) throws TxnException;

    /**
     * 生成客户资源联系点文件(增量)
     * @param cmCustomerFirstLevel
     * @return
     */
    String createCustResourceFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成电话联系点文件(增量)
     * @param cmCustomerFirstLevel
     * @return
     */
    String createCustTelFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成个人客户信息文件(增量)
     * @param cmCustomerFirstLevel
     * @return
     */
    String createPersonalFileMessage(CmCustomerFirstLevel cmCustomerFirstLevel) throws TxnException;

    /**
     * 生成风控信息文件（增量）
     * @param tlLoanClassifyChange
     * @return
     */
    String createRisManagementFileMessage(TlLoanClassifyChange tlLoanClassifyChange) throws TxnException;

    /**
     * 生成对应文件
     * @param messageList
     * @param reportingPath
     * @param fileName
     * @param fileType
     * @throws IOException
     */
    void generateUnionFile(List<String> messageList, String reportingPath , String fileName, String fileType) throws TxnException;

    /**
     * 合并文件,生成验签文件
     * @param org
     * @param filePath
     * @throws TxnException
     */
    void mergeFile(PrOrganizationTable org, String filePath) throws IOException;

    /**
     * 按照路径压缩文件,并传输压缩文件
     * @param org
     * @param filePath
     * @param outFilePath
     * @param nftsPath
     * @throws IOException
     */
    void compressFile(PrOrganizationTable org, String filePath, String outFilePath, String nftsPath) throws IOException;
}
